<?php
include_once("../configs/admin.config.inc.php");	//--> admin global var
include_once("db.inc.php");							//--> db global var
include_once("Smarty.class.php");					//--> out template
include_once("Operation.php");						//--> Operation
include_once("PicReview.php");						//--> PicReview
require_once("controlHeader.php");					//--> system control header
include_once("Strings.php");						//--> String
include_once("Audio.php");							//--> Audio
include_once("Users.php");							//--> user

$objOperate		= new Operation($objSession->session['lan']);			//--> Operation
$objPicReview	= new PicReview($objSession->session['lan'], $uid);		//--> PicReview
$objString  	= new Strings();										//--> String
$objAudio		= new Audio($objSession->session['lan'], $uid);			//--> Audio
$objUser 		= new Users($uid);										//--> user

$error_message 	= '';
$PicName 		= '';

if(isset($_GET['picid']))
	$picid = $_GET['picid'];
else if(isset($_POST['picid']))
	$picid = $_POST['picid'];

$arrOperate 	= $objOperate->arrGetFromGroupIDAndMenuID($gid, $menuid);
$arrOperateInfo = $objOperate->arrGetOPInfo($arrOperate);


$arrDataInfo = $objAudio->getFromID($arrOperate, $picid);
if(is_array($arrDataInfo)){
	$PicName = $arrDataInfo['name'];
}
if(!empty($picid)){
	$arrDataList = $objPicReview->lists($arrOperate, " WHERE picid=$picid ORDER BY id DESC", $page, DISPLAY_DATA_SIZE, '');
	if(is_array($arrDataList)){
		foreach($arrDataList as $key => $value){
			if(empty($value['userid']))
				$arrDataList[$key]['username'] = "游客";
			else{
				$arrUserInfo = $objUser->getFromID($arrOperate, $value['userid']);
				$arrDataList[$key]['username'] = $arrUserInfo['FirstName'];
			}
		}
	}
}

/*----- out html -----*/
$smarty = new Smarty();		//----- out template
$smarty->template_dir = TEMPLATE_DIR;
$smarty->compile_dir  = COMPILE_DIR;

$smarty->assign('error_message', $error_message.$bookName);
$smarty->assign('menuGid', $menuGid);
$smarty->assign('menuid', $menuid);
$smarty->assign('backurl',$backurl);

$smarty->assign('selfFileName', $objOperate->strGetSelfFileName());
$smarty->assign('arrOperateInfo', $arrOperateInfo);

$smarty->assign('arrDataList', $arrDataList);
$smarty->assign('PAGE_BAR', $objAudioReview->pagenav);

$smarty->assign('picid', $picid);

$smarty->display('listPicReview.htm');
?>
